Run event tracking and duplicate runStarted fix#1502
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a web-component analytics/eventing bug where HTML and Python projects could dispatch editor-runStarted twice on the first Run click by decoupling “run started” from “run completed” side-effects and gating runStarted to only fire on the codeRunTriggered rising edge.
Changes:
- Split
runStartedandrunCompleteddispatch logic into separateuseEffecthooks. - Add a
useRefguard to ensureeditor-runStartedonly fires whencodeRunTriggeredtransitionsfalse → true. - Strengthen the unit test to assert
editor-runStartedfires exactly once.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/components/WebComponentProject/WebComponentProject.jsx |
Prevents duplicate editor-runStarted dispatch by tracking prior codeRunTriggered state and separating effects. |
src/components/WebComponentProject/WebComponentProject.test.js |
Updates test setup and assertion to verify editor-runStarted fires only once. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d992e34 to
1174d2a
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1174d2a. Configure here.
| isErrorFree: error === "", | ||
| step: currentStepPosition, | ||
| errorDetails, | ||
| friendlyErrorShown: Boolean(friendlyError?.html), |
There was a problem hiding this comment.
Stale friendly error tracking flag
Medium Severity
The new friendlyErrorShown field on editor-runCompleted is derived only from friendlyError?.html in Redux. Skulpt clears error and errorDetails at run start but does not clear friendlyError, so a successful run after a failed one can still emit friendlyErrorShown: true while isErrorFree is true.
Reviewed by Cursor Bugbot for commit 1174d2a. Configure here.


Relates to issues:
1483
1520
Relates to editor-standalone#954.
Summary
Fixes a bug where HTML and Python projects dispatched
editor-runStartedtwice on the first Run click, and extendseditor-runCompletedso editor-standalone can buildProject - Run completedevents with structured error data.Duplicate
editor-runStartedRun-started and run-completed logic lived in one
useEffect. After the firstrunStarteddispatch,setCodeHasRun(true)re-ran that effect whilecodeRunTriggeredwas still true, so the event fired again. This splits those into separate effects and only dispatchesrunStartedwhencodeRunTriggeredgoes from false to true.editor-runCompletedpayload for run trackingAdds to the existing
editor-runCompletedevent (which already includedisErrorFreeand Mission Zero fields):projectIdentifierandprojectTypeonrunStartedandrunCompletederrorDetailson standard editor runs (previously only sent inoutputOnlymode)friendlyErrorShown- whether PFEM was displayededitor-standalone uses this to post
Project - Run completedwitherror_fingerprintanderror_style.